package com.example.lib_common.view.adapter

import android.widget.ImageView
import androidx.databinding.BindingAdapter
import com.bumptech.glide.Glide
import com.example.lib_image.glide.glide.GlideImgLoader

object CommonBindingAdapter {
    @JvmStatic
    @BindingAdapter("loadResImage")
    fun loadResImage(iv: ImageView, resId: Int){
        if (resId != 0){
            GlideImgLoader.loadResImage(iv, resId, iv)
        }
    }

    @JvmStatic
    @BindingAdapter("loadUrlImage")
    fun loadUrlImage(iv: ImageView, url: String){
        if (!url.isNullOrEmpty()){
            GlideImgLoader.loadImage(iv.context, url, iv)
        }
    }
}